#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long LL;
LL n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		LL ans = 0;
		while (n) {
			ans += n;
			n /= 2;
		}
		cout << ans << endl;
	}
	return 0;
}